package com.su.ch.adapter;

import java.util.List;

import org.jivesoftware.smack.RosterEntry;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.su.ch.R;

public class ChatFriendAdapter extends BaseAdapter {
	private List<RosterEntry> entries;
	private Context context;
	

	public ChatFriendAdapter(Context context, List<RosterEntry> entries) {
		super();
		this.context = context;
		this.entries = entries;
	}

	@Override
	public int getCount() {
		return entries.size();
	}

	@Override
	public Object getItem(int position) {
		return entries.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = LayoutInflater.from(context).inflate(R.layout.chat_friend_item_ly, null);
		TextView chat_item_child_nick = (TextView) convertView.findViewById(R.id.chat_item_child_nick);
		chat_item_child_nick.setText(entries.get(position).getName());
		
		Log.v("larson", "-----------------"+entries.get(position).getName());
		return convertView;
	}

}
